package com.prototype.deepclone;

/**
 * @author Vhong
 * @version 1.0
 * 深克隆：创建一个新对象，属性中引用的其他对象也会被克隆，不再指向原有对象地址。
 */
public class Client {
    public static void main(String[] args) {
        WeeklyLog log_1,log_2 = null;
        log_1 = new WeeklyLog();
        Attachment attachment = new Attachment();
        log_1.setAttachment(attachment);

        try {
            log_2 = log_1.deepclone();
        } catch (Exception e) {
            e.printStackTrace();
        }//克隆周报
        System.out.println("周报是否相同："+(log_1 == log_2));
        System.out.println("周报是否相同："+(log_1.getAttachment() == log_2.getAttachment()));


    }
}
